﻿using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Runtime.Serialization;

namespace BarManager.Core.Entity
{
    [Table("OrdenDetallePromocion")]
    [DataContract]
    public class OrdenDetallePromocion : OrdenDetalleBase
    {
        [Required]
        [DataMember]
        public int PromocionId { get; set; }

        [DataMember]
        public virtual Promocion Promocion { get; set; }

        [DataMember]
        public override decimal SubTotalPagado
        {
            get
            {
                decimal subtotal = Precio * CantidadPagada;
                return (subtotal <= 0) ? 0 : subtotal;
            }
        }

        [DataMember]
        public override decimal SubTotalPorPagar
        {
            get { return SubTotal - SubTotalPagado - SubTotalRegalos; }
        }

        [DataMember]
        public override decimal SubTotal
        {
            get
            {
                decimal subtotal = Precio * Cantidad;
                return (subtotal <= 0) ? 0 : subtotal;
            }
        }

        [DataMember]
        public override decimal Precio
        {
            get { return Promocion.Total; }
        }
    }
}
